home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 2.5 KB | 148 lines | [TEXT/ttxt] |
- in module Autofinder
-
- class Button (Actuator)
- inst vars
- pressedBitmap
- releasedBitmap
- disabledBitmap
- authordata
- pressAction
- releaseAction
- activateAction
- multiActivateAction
- end
-
- method init self {class Button} #rest args
- #key pressedBitmap:(undefined) \
- releasedBitmap:(undefined) \
- disabledBitmap:(undefined) ->
- (
- apply nextmethod self args
- self.pressedBitmap := pressedBitmap
- self.releasedBitmap := releasedBitmap
- self.disabledBitmap := disabledBitmap
-
- self
- )
-
- method afterInit self {class Button} #rest args ->
- (
- nextmethod self
- setReleasedAppearance self
- self
- )
-
- method handlePress self {class Button} ->
- (
- if (self.pressAction != undefined) do
- self.pressAction self.authordata self
- )
-
- method handleRelease self {class Button} ->
- (
- if (self.releaseAction != undefined) do
- self.releaseAction self.authordata self
- )
-
- method handleActivate self {class Button} ->
- (
- if (self.activateAction != undefined) do
- self.activateAction self.authordata self
- )
-
- method handleMultiActivate self {class Button} n ->
- (
- if (self.multiActivateAction != undefined) do
- self.multiActivateAction self.authordata self n
- )
-
- method setPressedAppearance self {class Button} ->
- (
- if (self.pressedBitmap != undefined) do
- self.boundary := self.pressedBitmap
- )
-
- method setReleasedAppearance self {class Button} ->
- (
- if (self.releasedBitmap != undefined) do
- (
- self.boundary := self.releasedBitmap
- -- NOTE!!! THIS IS DUE TO BUG #4172
- self.fill := undefined
- )
- )
-
- method setDisabledAppearance self {class Button} ->
- (
- if (self.disabledBitmap != undefined) do
- self.boundary := self.disabledBitmap
- )
-
- method setActivatedAppearance self {class Button} ->
- (
- setReleasedAppearance self
- )
-
- method press self {class Button} ->
- (
- if not self.enabled do
- return
-
- nextmethod self
-
- setPressedAppearance self
-
- handlePress self
- )
-
- method release self {class Button} ->
- (
- if not self.enabled do
- return
-
- nextmethod self
-
- setReleasedAppearance self
-
- handleRelease self
- )
-
- method activate self {class Button} ->
- (
- if not self.enabled do
- return
-
- nextmethod self
-
- setActivatedAppearance self
-
- handleActivate self
- )
-
- method multiActivate self {class Button} n ->
- (
- if not self.enabled do
- return
-
- nextmethod self n
-
- setActivatedAppearance self
-
- handleMultiActivate self n
- )
-
- method enabledSetter self {class Button} value ->
- (
- nextmethod self value
-
- if value then
- setReleasedAppearance self
- else
- setDisabledAppearance self
-
- return value
- )
-
-
-
-